cmake_minimum_required(VERSION 2.8)

project(Study)

if(CMAKE_SIZEOF_VOID_P EQUAL 8) 
   set(GLEW_ARCH x64) 
   set(GLFW_ARCH win64) 
else() 
   set(GLEW_ARCH Win32) 
   set(GLFW_ARCH win32) 
endif() 

# https://github.com/rpavlik/cmake-modules
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/external/cmake-modules)
cmake_policy(SET CMP0026 OLD)
include(CreateLaunchers)

include_directories(
    external/glew-win32-binaries/include
    external/glfw-${GLFW_ARCH}-binaries/include
    external/glm
    common
    src
)

link_libraries(
    OpenGL32.lib
    ${CMAKE_SOURCE_DIR}/external/glew-win32-binaries/lib/Release/${GLEW_ARCH}/glew32s.lib
    ${CMAKE_SOURCE_DIR}/external/glfw-${GLFW_ARCH}-binaries/lib-vc2015/glfw3.lib
)

add_executable(case01 case01/main.cpp)
set_target_properties(case01 PROPERTIES
    COMPILE_DEFINITIONS GLEW_STATIC
)

add_executable(case02 case02/main.cpp
    common/shader.hpp
    common/shader.cpp
    common/globjs.h)

set_target_properties(case02 PROPERTIES
    COMPILE_DEFINITIONS GLEW_STATIC
)

create_target_launcher(case02 WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/case02/")

add_executable(case03 case03/main.cpp
    common/shader.hpp
    common/shader.cpp
    common/globjs.h)

set_target_properties(case03 PROPERTIES
    COMPILE_DEFINITIONS GLEW_STATIC
)

create_target_launcher(case03 WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/case03/")

add_executable(case04 case04/main.cpp
    common/shader.hpp
    common/shader.cpp
    common/globjs.h)

set_target_properties(case04 PROPERTIES
    COMPILE_DEFINITIONS GLEW_STATIC
)

create_target_launcher(case04 WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/case04/")

add_executable(case05 case05/main.cpp
    common/bitmap.h
    common/bitmap.cpp
    common/shader.hpp
    common/shader.cpp
    common/globjs.h)

set_target_properties(case05 PROPERTIES
    COMPILE_DEFINITIONS GLEW_STATIC
)

create_target_launcher(case05 WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/case05/")

add_executable(case06 case06/main.cpp
    common/bitmap.h
    common/bitmap.cpp
    common/shader.hpp
    common/shader.cpp
    common/globjs.h)

set_target_properties(case06 PROPERTIES
    COMPILE_DEFINITIONS GLEW_STATIC
)

create_target_launcher(case06 WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/case06/")

add_executable(case07 case07/main.cpp
    common/bitmap.h
    common/bitmap.cpp
    common/shader.hpp
    common/shader.cpp
    common/globjs.h)

set_target_properties(case07 PROPERTIES
    COMPILE_DEFINITIONS GLEW_STATIC
)

create_target_launcher(case07 WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/case07/")

add_executable(case08 case08/main.cpp
    common/bitmap.h
    common/bitmap.cpp
    common/shader.hpp
    common/shader.cpp
    common/globjs.h)

set_target_properties(case08 PROPERTIES
    COMPILE_DEFINITIONS GLEW_STATIC
)

create_target_launcher(case08 WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/case08/")

